package com.example.demo.firemain.data;



import com.example.demo.firemain.ByteUtil;
import lombok.Data;

/**
 * 运营商地位
 * 用户信息传输装置操作
 *
 * @author TDS
 * @date 2022/08/23
 */
@Data
public class OperatorStatus  {

    private String operation_flag;
    private Integer person;
    private Integer status;
    private String device_id;
    public OperatorStatus(String data ,String deviceId){

			this.device_id = deviceId;
        String bit = ByteUtil.buqi2(Integer.toBinaryString(Integer.parseInt(data.substring(4,6),16)));
        if ("1".equals(bit.substring(7))){
            operation_flag = "复位";
        }else if ("1".equals(bit.substring(6,7))){
            operation_flag = "消音";
        }else if ("1".equals(bit.substring(5,6))){
            operation_flag = "手动报警";
        }else if ("1".equals(bit.substring(4,5))){
            operation_flag = "警情解除";
        }else if ("1".equals(bit.substring(3,4))){
            operation_flag = "自检";
        }else if ("1".equals(bit.substring(2,3))){
            operation_flag = "查岗应答";
        }else if ("1".equals(bit.substring(1,2))){
            operation_flag = "测试";
        }else{
            operation_flag = "正常";
        }
        person = Integer.parseInt(data.substring(6,8),16);
        status =2;

    }

}
